<cfsetting enablecfoutputonly="Yes">

<!--- 
  /**
   * Variables setup and initialization for Mireau.
   * 
   * @author  <info@mireau.net>
   * @version 1.0 - <yyyy/mm/dd>
   */
--->

<cfscript>
  /*
   * This will replace the  'formurl2attributes' customtag
   */
  attributes = structNew();  
  structAppend( attributes, url,  true );  
  structAppend( attributes, form, true );

  if( not isDefined( "attributes.fuseaction" ))
  {
    attributes.fuseaction = request.site.s_DEFAULT_FUSEACTION;
  }
</cfscript>

<!--- //
      // If no fuseaction array existed in the Application scope, make one 
      //
      // The design of this array will be like this:
      // 
      //   xFuseaction[x][1] | FUSETYPE             | var, dps, ..
      //   xFuseaction[x][2] | EXTENSION            | .cfm, .xml, ..
      //   xFuseaction[x][3] | DIRECTORY            | in which these fusetypes 
      //                     |                      | _could _ be grouped 
      //                     |                      | together
      //   xFuseaction[x][4] | APP_INDEX PROCESSING |
      //   xFuseaction[x][5] | 404 CHECK            |
      //
--->
<cflock
  timeout="5"
  scope="application"
  type="exclusive"
>
  <cfscript>
    if(
        ( not isDefined( "application.xFuseaction" )) or 
        ( isDefined( "attributes.bRecycle" ))
      )
    {
      application.xFuseaction = arrayNew( 2 );

      application.xFuseaction[1][1]   = "var";
      application.xFuseaction[1][2]   = "cfm";
      application.xFuseaction[1][3]   = "variables";
      application.xFuseaction[1][4]   = 1;
      application.xFuseaction[1][5]   = 0;
      
      application.xFuseaction[2][1]   = "sec";
      application.xFuseaction[2][2]   = "cfm";
      application.xFuseaction[2][3]   = "security";
      application.xFuseaction[2][4]   = 1;
      application.xFuseaction[2][5]   = 0;
      
      application.xFuseaction[3][1]   = "qry";
      application.xFuseaction[3][2]   = "cfm";
      application.xFuseaction[3][3]   = "queries";
      application.xFuseaction[3][4]   = 1;
      application.xFuseaction[3][5]   = 1;
      
      application.xFuseaction[4][1]   = "act";
      application.xFuseaction[4][2]   = "cfm";
      application.xFuseaction[4][3]   = "actions";
      application.xFuseaction[4][4]   = 1;
      application.xFuseaction[4][5]   = 1;
      
      application.xFuseaction[5][1]   = "url";
      application.xFuseaction[5][2]   = "cfm";
      application.xFuseaction[5][3]   = "locations";
      application.xFuseaction[5][4]   = 1;
      application.xFuseaction[5][5]   = 0;
      
      application.xFuseaction[6][1]   = "scr";
      application.xFuseaction[6][2]   = "js";
      application.xFuseaction[6][3]   = "scripts";
      application.xFuseaction[6][4]   = 1;
      application.xFuseaction[6][5]   = 0;
      
      application.xFuseaction[7][1]   = "dsp";
      application.xFuseaction[7][2]   = "cfm";
      application.xFuseaction[7][3]   = "blocks";
      application.xFuseaction[7][4]   = 1;
      application.xFuseaction[7][5]   = 1;

      application.xFuseaction[8][1]   = "plp";
      application.xFuseaction[8][2]   = "xml";
      application.xFuseaction[8][3]   = "plp";
      application.xFuseaction[8][4]   = 0;
      application.xFuseaction[8][5]   = 0;

      application.xFuseaction[9][1]   = "lan";
      application.xFuseaction[9][2]   = "xml";
      application.xFuseaction[9][3]   = "languages";
      application.xFuseaction[9][4]   = 0;
      application.xFuseaction[9][5]   = 0;

      application.xFuseaction[10][1]  = "hlp";
      application.xFuseaction[10][2]  = "cfm";
      application.xFuseaction[10][3]  = "help";
      application.xFuseaction[10][4]  = 0;
      application.xFuseaction[10][5]  = 0;
    }
  </cfscript>
</cflock>

<cflock
  timeout="5"
  scope="application"
  type="readonly"
>
  <cfscript>
    /* 
     * Copy the fuseaction array to the request scope where it's visible in the
     * whole application.
     */
    request.fusebox.xFuseaction = duplicate( application.xFuseaction );
  </cfscript>
</cflock>

<cflock
  timeout="5"
  scope="session"
  type="exclusive"
>
  <cfscript>
    if( not isDefined( "session.security" ))
    {
      session.security = structNew();
      session.security.user_nID   = request.site.n_NOT_SET;
      session.security.user_sName = request.site.s_NOT_SET;
    }
    
    request.security = duplicate( session.security );
  </cfscript>
</cflock>

<cfsetting enablecfoutputonly="No">